add_library(rbd_mirror_types STATIC
  image_map/Types.cc
  instance_watcher/Types.cc
  leader_watcher/Types.cc)

set(rbd_mirror_internal
  ClusterWatcher.cc
  ImageDeleter.cc
  ImageMap.cc
  ImageReplayer.cc
  ImageSync.cc
  InstanceReplayer.cc
  InstanceWatcher.cc
  Instances.cc
  LeaderWatcher.cc
  Mirror.cc
  MirrorStatusUpdater.cc
  MirrorStatusWatcher.cc
  NamespaceReplayer.cc
  PoolMetaCache.cc
  PoolReplayer.cc
  PoolWatcher.cc
  RemotePoolPoller.cc
  ServiceDaemon.cc
  Threads.cc
  Throttler.cc
  Types.cc
  image_deleter/SnapshotPurgeRequest.cc
  image_deleter/TrashMoveRequest.cc
  image_deleter/TrashRemoveRequest.cc
  image_deleter/TrashWatcher.cc
  image_map/LoadRequest.cc
  image_map/Policy.cc
  image_map/SimplePolicy.cc
  image_map/StateTransition.cc
  image_map/UpdateRequest.cc
  image_replayer/BootstrapRequest.cc
  image_replayer/CloseImageRequest.cc
  image_replayer/CreateImageRequest.cc
  image_replayer/GetMirrorImageIdRequest.cc
  image_replayer/OpenImageRequest.cc
  image_replayer/OpenLocalImageRequest.cc
  image_replayer/PrepareLocalImageRequest.cc
  image_replayer/PrepareRemoteImageRequest.cc
  image_replayer/StateBuilder.cc
  image_replayer/TimeRollingMean.cc
  image_replayer/Utils.cc
  image_replayer/journal/CreateLocalImageRequest.cc
  image_replayer/journal/EventPreprocessor.cc
  image_replayer/journal/PrepareReplayRequest.cc
  image_replayer/journal/Replayer.cc
  image_replayer/journal/ReplayStatusFormatter.cc
  image_replayer/journal/StateBuilder.cc
  image_replayer/journal/SyncPointHandler.cc
  image_replayer/snapshot/ApplyImageStateRequest.cc
  image_replayer/snapshot/CreateLocalImageRequest.cc
  image_replayer/snapshot/PrepareReplayRequest.cc
  image_replayer/snapshot/Replayer.cc
  image_replayer/snapshot/StateBuilder.cc
  image_replayer/snapshot/Utils.cc
  image_sync/SyncPointCreateRequest.cc
  image_sync/SyncPointPruneRequest.cc
  image_sync/Utils.cc
  pool_watcher/RefreshImagesRequest.cc
  service_daemon/Types.cc)

add_library(rbd_mirror_internal STATIC
  ${rbd_mirror_internal}
  $<TARGET_OBJECTS:common_prioritycache_obj>)

add_executable(rbd-mirror
  main.cc)
target_link_libraries(rbd-mirror
  rbd_mirror_internal
  rbd_mirror_types
  rbd_api
  rbd_internal
  rbd_types
  journal
  librados
  osdc
  cls_rbd_client
  cls_lock_client
  cls_journal_client
  global
  heap_profiler
  ${ALLOC_LIBS})
install(TARGETS rbd-mirror DESTINATION bin)
